package com.adcc.swingui.demo.menubar;

import java.awt.Container;
import java.util.List;

import javax.swing.ButtonGroup;
import javax.swing.ImageIcon;
import javax.swing.JComponent;
import javax.swing.JMenu;
import javax.swing.JMenuItem;
import javax.swing.JRadioButtonMenuItem;

import com.adcc.swingui.base.DefaultMenuBar;
import com.jidesoft.swing.JideMenu;

/**
 * 天气雷达
 * 
 * @author Administrator
 * 
 */
public class TianQiLeiDaMenuBut extends DefaultMenuBar {

	JMenu menu;
	JMenu raJMenu;

	ButtonGroup raMenuGroup;

	JRadioButtonMenuItem allItem;
	JRadioButtonMenuItem neItem;
	JRadioButtonMenuItem nItem;
	JRadioButtonMenuItem eItem;
	JRadioButtonMenuItem sItem;
	JRadioButtonMenuItem swItem;
	JRadioButtonMenuItem nwItem;
	JRadioButtonMenuItem xinjiangItem;

	JMenuItem singleItem;
	JMenuItem hideItem;

	public TianQiLeiDaMenuBut(Container container) {
		super(container);
	}

	@Override
	protected JComponent build() {
		// TODO Auto-generated method stub
		menu = new JideMenu("天气雷达资料");
		menu.setMnemonic('T');

		// 雷达拼图
		raJMenu = new JMenu("雷达拼图");
		raMenuGroup = new ButtonGroup();
		allItem = createRadioButtonMenuItem("showCountry", "全国", raMenuGroup);
		addChildMenu(raJMenu, allItem, allItem.getName(), true);
		neItem = createRadioButtonMenuItem("showNorthEast", "东北", raMenuGroup);
		addChildMenu(raJMenu, neItem, neItem.getName(), true);
		nItem = createRadioButtonMenuItem("showNorth", "华北", raMenuGroup);
		addChildMenu(raJMenu, nItem, nItem.getName(), true);
		eItem = createRadioButtonMenuItem("showEast", "华东", raMenuGroup);
		addChildMenu(raJMenu, eItem, eItem.getName(), true);
		sItem = createRadioButtonMenuItem("showSouth", "中南", raMenuGroup);
		addChildMenu(raJMenu, sItem, sItem.getName(), true);
		swItem = createRadioButtonMenuItem("showSouthWest", "西南", raMenuGroup);
		addChildMenu(raJMenu, swItem, swItem.getName(), true);
		nwItem = createRadioButtonMenuItem("showNorthWest", "西北", raMenuGroup);
		addChildMenu(raJMenu, nwItem, nwItem.getName(), true);
		xinjiangItem = createRadioButtonMenuItem("showXinjiang", "新疆",
				raMenuGroup);
		addChildMenu(raJMenu, xinjiangItem, xinjiangItem.getName(), true);
		addChildMenu(menu, raJMenu, null);

		// 单站雷达
		singleItem = new JMenuItem("单站雷达", new ImageIcon());
		addChildMenu(menu, singleItem, "singleRadar", true);

		// 雷达站
		hideItem = new JMenuItem("雷达", new ImageIcon());
		addChildMenu(menu, hideItem, "showHideLayer", true);

		return menu;
	}

	public void showHideLayer() {
		System.out.println("HideLayer");
	}

	public void singleRadar() {
		System.out.println("single");
	}

	public void showCountry() {
		System.out.println("Country");
	}

	public void showNorth() {
		System.out.println("North");
	}

	public void showNorthEast() {
		System.out.println("northEast");
	}

	public void showEast() {
		System.out.println("east");
	}

	public void showSouth() {
		System.out.println("south");
	}

	public void showSouthWest() {
		System.out.println("southWest");
	}

	public void showNorthWest() {
		System.out.println("northWest");
	}

	public void showXinjiang() {
		System.out.println("xinjiang");
	}

	@Override
	protected void offLineVisiable(List<JComponent> jcomps) {
		// TODO Auto-generated method stub

	}

}
